home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 18 / fpc103.zip / DUMP.SEQ < prev    next >
Text File  |  1988-06-03  |  2KB  |  55 lines

  1. \ DUMP.SEQ      A simple dump utility      Enhancements by Tom Zimmer
  2.  
  3. DECIMAL
  4.  
  5. \ The dump utility gives you a formatted hex dump with the ascii
  6. \ text corresponding to the bytes on the right hand side of the
  7. \ screen.  In addition you can use the SM word to set a range of
  8. \ memory locations to desired values.  SM displays an address and
  9. \ its contents.  You can go forwards or backwards depending upon
  10. \ which character you type. Entering a hex number changes the
  11. \ contents of the location.  DL can be used to dump a line of
  12. \ text from a screen.
  13.  
  14. VARIABLE DUMPSEG
  15.  
  16. : DUMPC@        ( A1 --- C1 )
  17.                 DUMPSEG @ SWAP C@L ;
  18.  
  19. : .2   ( n -- )   0 <#   # #   #>   TYPE   SPACE   ;
  20.  
  21. : D.2   ( addr len -- )   BOUNDS ?DO   I DUMPC@ .2   LOOP   ;
  22.  
  23. : EMIT.   ( char -- )
  24.    127 AND DUP BL 126 BETWEEN NOT IF DROP ASCII . THEN EMIT ;
  25.  
  26. : DLN   ( addr --- )
  27.    CR   DUMPSEG @ 0 <# ASCII : HOLD # # # # #> TYPE
  28.         DUP 0 <# # # # # #> TYPE ."  | " 8 2DUP D.2
  29.    OVER + 8 D.2 ." |"   16 BOUNDS
  30.    ?DO   I DUMPC@ EMIT.   LOOP  ." |" ;
  31.  
  32. : .HEAD ( addr len -- addr' len' )
  33.         OVER 15 AND   CR ."  SEG:OFFSET \/ " 1+
  34.         15 0 DO DUP I + 15 AND 2 .R SPACE LOOP  SPACE 1-
  35.         16 0 DO DUP I + 15 AND 1 .R LOOP DROP ;
  36.  
  37. : LDUMP         ( addr len -- )
  38.                 BASE @ -ROT HEX .HEAD BOUNDS
  39.                 DO      I DLN  KEY? ?LEAVE
  40.             16 +LOOP    BASE !  CR ;
  41.  
  42. : DUMP          ( A1 N1 --- )
  43.                 ?CS: DUMPSEG !          LDUMP ;
  44.  
  45. : YDUMP         ( A1 N1 --- )
  46.                 YSEG @ DUMPSEG !        LDUMP ;
  47.  
  48. : XDUMP         ( SEG N1 --- )
  49.                 >R XSEG @ + DUMPSEG ! 0 R> LDUMP ;
  50.  
  51. : DU            ( addr -- addr+64 )
  52.                 DUP 64 LDUMP 64 +   ;
  53.  
  54.  
  55.